
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/select.h>

int main()
{
  int fd= 0;
  char buf[128];
  int num;
//  fd=open("/dev/hello",O_RDONLY); 阻塞方式读取 
  fd=open("/dev/hello",O_RDONLY|O_NONBLOCK);  //非阻塞   
  if(fd<0) 
  {     
    printf("open memdev failed!\n");     
    return -1;               
  }     
  read(fd,buf,sizeof(buf));  
  
  printf("num:%s\n",buf);  
  close(fd);
  return 0;     
  
}
